id/email
password
forgot password | create account
about | help | prefs
ReadingBatcode reading practice

 

 

Warmup 1HasEvens

prev  |  next  |  chance
public static boolean[] hasEvens(int[] vals) {

    boolean[] results = new boolean[vals.length];

    for (int i = 0; i < vals.length; i++)
        results[i] = vals[i] % 2 == 0;

    return results;
}
Function Call  Return Value
hasEvens(new int[]{5, 4, 5})
hasEvens(new int[]{4, 6, 8})
hasEvens(new int[]{5})
hasEvens(new int[]{6})
hasEvens(new int[]{101})
hasEvens(new int[]{99, 84})

Experiment with this code on Gitpod.io

⬅ Back